<template>
  <view class="confirm-order">
    <navBar title="确认订单" custom-back @back="onBack('prev')" @home="onBack('home')"></navBar>
    
    <view class="order-body" :style="{marginTop: `${getSystemInfo.navBarHeight}px`}">
      <!-- 门店信息 -->
      <view class="box space-between" @click="onSelectStore">
        <view class="space-between store-info">
          <view class="store-logo">
            <u--image
              v-if="storeInfo && storeInfo.photo1"
              width="120rpx"
              height="96rpx"
              :src="storeInfo.photo1">
            </u--image>
            <u--image
              v-else
              width="120rpx"
              height="96rpx"
              src="/static/goods_default_4.png">
            </u--image>
          </view>
          <view v-if="storeInfo">
            <text class="si-name">{{ storeInfo.name }}</text>
            <view class="si-address">
              <text class="b-red">{{ storeInfo.distance }}km</text>
              <!-- <text class="b-gray si-address">{{ storeInfo.address }}</text> -->
              <text class="b-gray">|</text>
              <view>
                <u--text
                  size="28rpx"
                  color="rgba(0,0,0,0.3)"
                  :lines="1"
                  :text="storeInfo.address">
                </u--text>
              </view>
            </view>
          </view>
          <view v-else>
            <text class="b-gray">请选择门店</text>
          </view>
        </view>
        <u-icon name="arrow-right"></u-icon>
      </view>
      
      <!-- 到店日期 -->
      <view class="box">
        <view class="space-between">
          <text>预计到店日期</text>
          <text v-if="!!formData.planArriveTime">{{ formData.planArriveTime }}</text>
          <text v-else class="b-gray">请选择到店日期</text>
        </view>
        <view class="co-date">
          <date-selector v-model="formData.planArriveTime"></date-selector>
        </view>
      </view>
      
      <!-- 商品信息 -->
      <view class="box">
        <view class="space-between">
          <text>商品信息</text>
        </view>
        <view class="goods-list">
          <view
            class="goods-info"
            v-for="(item, index) in goodsList"
            :class="(index === 0) && 'first'"
            :key="item.goodsId">
            <!-- 商品图片 -->
            <u--image v-if="item.goodsImges" width="80px" height="80px" :src="item.goodsImges"></u--image>
            <u--image v-else width="80px" height="80px" src="/static/goods_default_square.png"></u--image>
            <view class="goods-body">
              <!-- 商品名称 -->
              <view class="goods-name">
                <u--text size="28rpx" :lines="2" :text="item.exhibitionName"></u--text>
              </view>
              <!-- 标签 -->
               <view class="promotion" v-if="item.promotionList">
                 <view class="name" v-for="list in item.promotionList">
                  {{list}}
                 </view>
               </view>
              <!-- 价格和数量 -->
              <view class="price-number">
                <view class="pn-price">
                  <text class="money-symbol">¥</text>
                  <text>{{ formatMoney(item.price) }}</text>
                </view>
                <view class="pn-number">X{{ item.quantity }}</view>
              </view>
            </view>
          </view>
        </view>
      </view>
      
      <!-- 商品总额 -->
      <view class="box space-between">
        <text>商品总额</text>
        <view class="b-red goods-total">
          <text class="money-symbol">¥</text>
          <text>{{ formatMoney(goodsTotal) }}</text>
        </view>
      </view>
      
      <!-- 会员折扣 -->
      <view class="box space-between" >
        <text>会员折扣</text>
        <text class="b-red">您是会员，已享受95折优惠</text>
      </view>
      
      <!-- 优惠券 -->
      <view class="box space-between">
        <text>优惠券</text>
        <view v-if="hasCoupon" class="space-between b-right" @click="onSelectCoupon">
          <view v-if="formData.couponIds.length > 0">
            <text>使用{{ formData.couponIds.length }}张，</text>
            <text class="b-red">-¥{{ formatMoney(couponReductionAmount) }}</text>
          </view>
          <text v-else>不使用优惠券</text>
          <u-icon name="arrow-right"></u-icon>
        </view>
        <text v-else class="b-gray">暂无可用</text>
      </view>
      
      <!-- 积分 -->
      <view class="box space-between" @click="onIntegral">
        <text>积分</text>
        <view v-if="integral > 0" class="space-between b-right">
          <view v-if="formData.scoreMoney > 0">
            <!-- <text>使用{{ formData.payScore }}分，</text> -->
            <text class="b-red">-¥{{ formatMoney(formData.scoreMoney) }}</text>
          </view>
          <!-- 优惠券已抵扣全部金额后显示灰色 -->
          <text v-else :class="(goodsTotal - couponReductionAmount <= 0) && 'b-gray'">
            共{{ integral }}可用
          </text>
          <u-icon name="arrow-right"></u-icon>
        </view>
        <text v-else class="b-gray">暂无可用</text>
      </view>
      <!-- 选择积分 -->
      <integral-popup
        :visible.sync="visibleIntegral"
        :integral="integral"
        :max="payableAmount + formData.scoreMoney"
        @confirm="confirmIntegral">
      </integral-popup>
      
      <!-- 合计 -->
      <view class="box space-between">
        <text></text>
        <view class="space-between">
          <text>合计：</text>
          <view class="b-red">
            <text class="money-symbol">¥</text>
            <text>{{ formatMoney(payableAmount) }}</text>
          </view>
        </view>
      </view>
      
      <!-- 赠品选择 -->
      <view class="box space-between">
        <text>赠品选择</text>
        <view v-if="isGift" class="space-between b-right" @click="onSelectGift">
          <!-- <text class="b-gray">请点击选择您的赠品</text> -->
          <text>已选择{{ giftList.length }}个赠品</text>
          <u-icon name="arrow-right"></u-icon>
        </view>
				<text v-else class="b-gray">暂无赠品选择</text>
      </view>
      
      <!-- 赠品收获地址 -->
      <view class="box space-between">
        <text>赠品收获地址</text>
        <view v-if="isGift" class="space-between b-right" @click="onSelectGiftPlace">
					<view style="text-align: right;" v-if="defaultPlace.name">
						<view class="">{{ defaultPlace.name || '' }} {{ defaultPlace.tel ? formatPhone(defaultPlace.tel) : '' }}</view>
						<view class="">
							{{ defaultPlace.provinceName || '' }}
							{{ defaultPlace.cityName || '' }}
							{{ defaultPlace.countyName || '' }}
							{{ defaultPlace.addressDetail || '' }}
						</view>
					</view>
					<view v-else class="b-gray">请点击选择您的收货地址</view>
          <u-icon name="arrow-right"></u-icon>
        </view>
				<text v-else class="b-gray">暂无地址选择</text>
      </view>
      
      <!-- 发票信息 -->
			<!-- 车队车主登录，不需要开发票 -->
     <view class="box space-between" v-if="!getUserInfo.fleetFlag">
        <text>发票信息</text>
        <view class="space-between b-right" @click="drawInvoice">
          <text v-if="formData.invoicing && formData.invoicing.titleName">
            {{ formData.invoicing.titleName }}
          </text>
          <text v-else class="b-gray">不开发票</text>
          <u-icon name="arrow-right"></u-icon>
        </view>
      </view>
      
      <!-- 付款方式 -->
      <view class="box space-between" style="margin: 0;">
        <text>付款方式</text>
				<!-- 车队车主登录是授信额度支付 -->
        <view class="space-between b-right" v-if="!getUserInfo.fleetFlag">
          <text>在线支付</text>
          <!-- <u-icon name="arrow-right"></u-icon> -->
        </view>
      </view>
			<view class="box pay-radio-group" v-if="getUserInfo.fleetFlag">
				<u-radio-group v-model="payRadioValue">
					<u-radio
						v-for="item in payRadioGroup"
						:key="item.id"
						:label="item.name"
						:name="item.name"
						activeColor="red"
						size="18px"
						icon-size="14px"
						label-size="14px"
					></u-radio>
				</u-radio-group>
			</view>
      
      <!-- 弹窗：返回 -->
      <u-modal
        :show="visibleBack" 
        title="确定要放弃该订单吗？" 
        :showCancelButton="true" 
        cancelText="去意已决" 
        confirmText="我再想想" 
        confirmColor="#CF1A1B"
        @confirm="visibleBack = false"
        @cancel="confirmBack"
      >
      </u-modal>
			
			
			<!-- 车队车主，授信额度支付，校验 -->
				<u-popup
					:show="popupShow"
					:round="20"
					mode="bottom"
					@close="popupShow = false"
					:closeOnClickOverlay="true"
					>
					<view class="popup-content">
						<view class="pc-title">授信限制提示</view>
						<view class="pc-desc">
							每个车主单日使用额度上限10000元，您已超限，如需下单请修改订单金额或联系车队处理。
						</view>
						<view class="pc-action">
							<view class="pc-btn" @click.stop="popupShow = false">知道了</view>
						</view>
					</view>
				</u-popup>
    </view>
    
    <view class="order-footer">
      <view class="total">
        <text>应付金额：</text>
        <view class="t-price">
          <view v-if="formData.payScore > 0">
            <text>{{ formData.payScore }}积分</text>
            <text style="padding: 0 12rpx;">+</text>
          </view>
          <view class="b-red">
            <text class="money-symbol">¥</text>
            <text>{{ formatMoney(payableAmount > 0 ? payableAmount : 0.01) }}</text>
          </view>
        </view>
      </view>
      <view class="btn-submit" @click="onConfirm">提交订单</view>
    </view>
    
    <u-toast ref="uToast"></u-toast>
		
  </view>
</template>

<script>
  import dateSelector from '../components/date-selector/date-selector.vue'
  import integralPopup from '../components/integral-popup/integral-popup.vue'
  import navBar from '@/components/navBar.vue'
  import { mapState, mapGetters, mapMutations } from 'vuex'
  import { formatMoney } from '@/common/utils'
  import payment from '@/mixins/payment.js'
  
  export default {
    components: {
      dateSelector,
      integralPopup,
      navBar
    },
    mixins: [payment],
    data() {
      return {
        // 门店信息
        storeInfo: null,
        // 商品列表
        goodsList: [],
        // 轮胎类型商品列表
        tyreGoodsList: [],
        // 是否有可用优惠券
        hasCoupon: 0,
        // 优惠券减免金额
        couponReductionAmount: 0,
        // 可用积分
        integral: 0,
        // 选择积分弹窗
        visibleIntegral: false,
        // 返回弹窗
        visibleBack: false,
        backPosition: '',
        
        // 提交字段
        formData: {
          // 订单来源 CART=购物车，GOOD_DETAIL=商品详情
          sourceType: '',
          // 用户ID
          // 门店id和名称
          terminalId: '',
          terminalName: '',
          // 预计到店日期
          planArriveTime: '',
          // 商品信息
          goodsContext: [],
          // 优惠券id列表
          couponIds: [],
          // 抵扣积分
          payScore: 0,
          // 积分抵扣金额
          scoreMoney: 0,
          // 发票信息
          invoicing: null,
        },
        
        // 提交loading
        loading: false,
        
        // 生成订单id，
        orderId: '',
				
				payRadioGroup: [
					{
						name: '信用额度支付',
					},
				],
				payRadioValue: '信用额度支付',
				popupShow: false,
				
				// 是否有赠品
				isGift: false,
				giftList: [],
				// 默认地址
				defaultPlace: {}
      }
    },
    computed: {
      ...mapState('user', ['userInfo']),
      ...mapGetters('global', ['getSystemInfo']),
			...mapGetters('user', ['getUserInfo']),
			...mapGetters('cart', ['getGiftList']),
      // 商品总额（减扣前）
      goodsTotal() {
        return this.goodsList.reduce((acc, cur) => {
          acc += cur.price * cur.quantity
          return acc
        }, 0)
      },
      // 商品应付金额（减扣优惠券和积分后）
      payableAmount() {
        const result = this.goodsTotal - this.couponReductionAmount - this.formData.scoreMoney
        return result < 0 ? 0 : result
      },
      // 是否已创建订单
      isCreatedOrder() {
        return !!this.orderId
      },
			formatPhone(){
				return (tel) => {
					return tel.slice(0, 3) + '****' + tel.slice(-4)
				}
			}
    },
    methods: {
			...mapMutations('cart', ['setGiftList']),
			// 选择赠品收货地址
			onSelectGiftPlace(){
				if (this.giftList.length === 0) {
				  return false
				}
				uni.navigateTo({
					url: '/minePack/user/accountSetting/shippingAddress?type=select',
					events: {
					  //获取下级页面传递回来的参数
					  getAddressItem: data => {
							this.defaultPlace = data
							uni.navigateBack()
					  }
					},
				})
			},
			// 选择赠品
      onSelectGift(){
				if (this.giftList.length === 0) {
				  return false
				}
				uni.navigateTo({
				  url: '/components/giftList',
				})
			},
			
      // 支付失败
      payFailed(title = '未查到支付信息') {
        uni.showToast({ title, icon: 'error' })
        setTimeout(() => {
          uni.switchTab({ url: '/pages/index/index/index' })
        }, 1500)
      },
      
      // 提交订单
      async onConfirm() {
        if (this.loading || this.isCreatedOrder) {
          return false
        }
        await this.validate()
				
				// 有赠品
				if(this.giftList.length){
					// 赠品相关
					const address = {
						province: this.defaultPlace.province,
						city: this.defaultPlace.city,
						county: this.defaultPlace.county,
						name: this.defaultPlace.name,
						phone: this.defaultPlace.tel,
						addressDetail: this.defaultPlace.addressDetail,
					}
					
					const orderGifts = this.getGiftList.reduce((pre, cur) => {
						const obj = {
							ruleId: cur.ruleId,
							rewardId: cur.active,
							quantity: cur.awardsNumber
						}
						pre.push(obj)
						return pre
					}, [])
					
					this.formData.address = address
					this.formData.orderGifts = orderGifts
				}
				
				this.loading = true
				uni.showLoading({ title: '网络请求中' })
				
        try {
          // 提交订单
          const { datas } = await this.$request({
            url: '/order-center/car-owner-order/createOrder',
            data: this.formData
          })
          this.loading = false
          this.orderId = datas.orderId
          uni.hideLoading()
          
					// 车队车主用户登录，订单提交后跳转到，提交成功页面
					if(this.getUserInfo.fleetFlag){
						uni.redirectTo({
							url: `/cartPack/paymentSuccess/submitSuccess?payableAmount=${this.formatMoney(this.payableAmount)}&orderId=${this.orderId}`,
						})
					}else {
						// 跳转拉卡拉支付
						this.toPay(datas.counterUrl)
					}
					
          // // 跳转拉卡拉支付
          // this.toPay(datas.counterUrl)
        } catch (err) {
          this.loading = false
          uni.hideLoading()
					this.$refs.uToast.show({ message: err.respMsg  || '创建订单失败', position: 'top' })
					if(this.getUserInfo.fleetFlag){
						this.popupShow = true
					}
        }
      },
      
      // 开发票
      drawInvoice() {
        const invoiceAmount = this.payableAmount
        uni.navigateTo({
          url: '/minePack/function/invoice/drawInvoice',
          events: {
            drawInvoiceInfo: (res) => {
              const info = { ...res }
							console.log(info);
              this.$set(this.formData, 'invoicing', info)
            }
          },
          success: (res) => {
            const invoice = this.formData.invoicing
            const params = { invoiceAmount }
            if (invoice && invoice.titleName) {
              // 已存在发票信息
              params.invoice = { ...invoice }
            }
            res.eventChannel.emit('drawInvoice', params)
          }
        })
      },
      
      // 选择门店
      onSelectStore() {
        uni.navigateTo({
        	url: '/components/selectStore',
        	events: {
        		setStoreAdress: (data) => {
              this.formData.terminalId = data.id
              this.formData.terminalName = data.name
              this.storeInfo = data
        		}
        	}
        })
      },
      
      // 选择优惠券
      onSelectCoupon() {
        if (this.couponNum === 0) {
          return false
        }
        uni.navigateTo({
          url: '/components/selectCoupon',
          events: {
            //获取下级页面传递回来的参数
            selectCoupon: data => {
              const { reductionAmount, selectedCoupons } = data
              this.couponReductionAmount = reductionAmount
              this.formData.couponIds = selectedCoupons
            }
          },
          success: (res) => {
            res.eventChannel.emit('initCoupon', {
              // 轮胎商品列表
              tyreGoodsList: [...this.tyreGoodsList],
              // 选择的优惠券id
              selectedCouponIds: [...this.formData.couponIds],
              // 订单(除优惠券以外)待优惠金额（使用除优惠券以外其他减扣方式之后的订单应付金额）
              unpricedAmount: this.goodsTotal - this.formData.scoreMoney,
            })
          }
        })
      },
      
      // 选择积分
      onIntegral() {
        // 订单(除积分以外)待优惠金额（使用除积分以外其他减扣方式之后的订单应付金额）
        const unpricedAmount = this.goodsTotal - this.couponReductionAmount
        
        if (unpricedAmount <= 0) {
          this.$refs.uToast.show({ message: '当前已是最大优惠', position: 'top' })
          return
        }
        
        if (this.integral > 0) {
          this.visibleIntegral = true
        }
      },
      
      confirmIntegral(data) {
        // 抵扣积分
        this.formData.payScore = data.usedIntegral
        // 积分抵扣金额
        this.formData.scoreMoney = data.deductionAmount
      },
      
      // 获取可用优惠券
      async getCoupon() {
        const tyreGoodsIds = [] // 轮胎类型商品ID列表
        let tyreGoodsNum = 0 // 轮胎类型商品总数
        let tyreGoodsTotalPrice = 0 // 轮胎类型商品总价
        
        this.tyreGoodsList.forEach(item => {
          tyreGoodsIds.push(item.goodsId)
          tyreGoodsNum += item.quantity
          tyreGoodsTotalPrice += (item.quantity * item.price)
        })
        
        if (tyreGoodsIds.length > 0) {
          const { datas } = await this.$request({
            url: '/marketing-center/distribution/listByAPP',
            data: {
              couponStatusList: ['0'],
              pageNum: 1,
              pageSize: tyreGoodsNum,
              goodIds: tyreGoodsIds,
              userId: this.userInfo.id
            }
          })
          if (datas.count > 0) {
            this.hasCoupon = true
            this.autoSelectCoupon(datas.data, tyreGoodsNum, tyreGoodsTotalPrice)
          }
        }
      },
      
      // 自动选取优惠券
      // 1、选取的优惠券总数量不能超过轮胎总数，
      // 2、优惠券优惠金额不超过轮胎商品总额
      autoSelectCoupon(coupons, num, totalPrice) {
        // 优惠券累计减免金额
        let reductionAmount = 0
        
        coupons.splice(0, num).forEach(item => {
          if (reductionAmount < totalPrice) {
            const accAmount = reductionAmount + item.denomination // 当前累加
            reductionAmount = accAmount > totalPrice ? totalPrice : accAmount
            this.formData.couponIds.push(item.id)
          }
        })
        this.couponReductionAmount = reductionAmount
      },
      
      // 获取可用积分
      async getIntegral() {
        const { datas } = await this.$request({
          url: '/marketing-center/integralRuleDetails/getUserIntegral',
          data: {
            userId: this.userInfo.id
          }
        })
        this.integral = datas.notUsed
      },
      
      // 使用商品id获取商品类型
      async getGoodsType() {
        const goodIds = this.goodsList.map(item => item.goodsId)
        const { datas } = await this.$request({
          url: '/product-center/supply-chain-goods/checkGoodsTypeByGoodId',
          data: { goodIds }
        })
        
        // 过滤轮胎商品
        if (datas.tyreList && datas.tyreList.length > 0) {
          this.tyreGoodsList = this.goodsList.filter(item => {
            return datas.tyreList.includes(item.goodsId)
          })
        }
      },
      
      /**
       * 设置订单数据
       * @param {String} data.sourceType 订单来源类型 CART=购物车，GOOD_DETAIL=商品详情
       * @param {Array<Object> | Object} data.data 商品信息。来源于购物车应是Array类型，商品详情为Object类型；
       * object: {
          goodsId,
          exhibitionName,
          price,
          quantity,
          goodsImges
        }
       * */
      async setOrderData(options) {
				console.log('options', options);
        const { sourceType: type, data } = options
        // 设置订单来源类型
        this.formData.sourceType = type
        
        // 来源购物车
        if (type === 'CART') {
          // 显示的商品信息
          this.goodsList = data
          // 提交的商品信息
          this.formData.goodsContext = data.map(item => ({
            goodsId: item.goodsId,
            quantity: item.quantity
          }))
        }
        
        // 来源商品详情
        if (type === 'GOOD_DETAIL') {
          // 显示的商品信息
          this.goodsList = [data]
          // 提交的商品信息
          this.formData.goodsContext = [{
            goodsId: data.goodsId,
            quantity: data.quantity
          }]
          // 门店信息
          const storeInfo = data.storeInfo
          if (storeInfo && storeInfo.id) {
            this.formData.terminalId = storeInfo.id
            this.formData.terminalName = storeInfo.name
            this.storeInfo = storeInfo
          }
          // 到店时间
          if (data.planArriveTime) {
            this.formData.planArriveTime = data.planArriveTime
          }
        }
				
				// 获取赠品
				const res = await this.getGift(this.formData.goodsContext)
				if(res.datas && res.datas.length){
					this.giftList = res.datas
					this.isGift = this.giftList.length > 0
					// 设置赠品默认选中为第一个
					this.giftList.map(i => {
						i.active = i.giftInfos[0].rewardId
					})
					this.setGiftList(this.giftList)
					
					// 获取默认地址
					const result = await this.getDefaultPlace()
					this.defaultPlace = result.datas || {}
				}

	
        try {
          const goodsId = this.goodsList.map(goods => goods.goodsId)
          const res = await this.$request({
            url: '/product-center/supply-chain-goods/list-by-ids',
            data: goodsId
          })
          res.datas.forEach(item => {
            this.goodsList.forEach(list => {
              if(item.id == list.goodsId){
                 list.promotionList = item.promotionLabelList	
              }
            })
          })
          
          await this.getGoodsType()
          this.getCoupon()
          this.getIntegral()
          
        } catch (err) {
          this.$refs.uToast.show({
            message: err.respMsg  || '请求失败',
            position: 'top',
            duration: 2000
          })
          setTimeout(() => {
            uni.navigateBack({
              success: () => {
                uni.$emit('loseGoods')
              }
            })
          }, 2000)
        }
      },
			
			async getDefaultPlace(){
				return await this.$request({
					method: 'GET',
					url: `/user-center/address/defaultAddress?userId=${this.getUserInfo.id}`
				})
			},
			async getGift(list){
				const goodsList = list.length && list.reduce((pre, cur) => {
					const obj = {
						goodsId: cur.goodsId,
						buyNumber: cur.quantity
					}
					pre.push(obj)
					return pre
				}, [])
				return await this.$request({
				  url: '/api-ltb/gift-api/searchGift ',
				  data: {
						activityObject: this.getUserInfo.userMember.levelId,
						goodsList,
						"terminalId": 0
					}
				})
			},
      
		 // 校验必填信息
			async validate() {
				return new Promise((resolve, reject) => {
					if (!this.formData.terminalId) {
						// 未选择门店
						const tips = '请选择门店'
						uni.showToast({ title: tips, icon: 'error' })
						reject(tips)
					} else if (!this.formData.planArriveTime) {
						// 未选择预计到店日期
						const tips = '请选择到店日期'
						uni.showToast({ title: tips, icon: 'error' })
						reject(tips)
					} else if(this.giftList.length && !this.defaultPlace.name){
						// 未选择地址
						const tips = '请选择地址'
						uni.showToast({ title: tips, icon: 'error' })
						reject(tips)
					}
					resolve()
				})
			},
      
      // 返回
      // position: home返回主页，prev返回上一页
      onBack(position) {
        this.backPosition = position
        this.visibleBack = true
      },
      // 确认返回
      confirmBack() {
        if (this.backPosition === 'home') {
          uni.switchTab({ url: '/pages/index/index/index' })
        } else if (this.backPosition === 'prev') {
          uni.navigateBack()
        }
      },
      
      formatMoney,
    },
    onLoad() {
      const eventChannel = this.getOpenerEventChannel()
      eventChannel.on('confirmOrder', this.setOrderData)
    }
  }
</script>

<style scoped lang="scss">
  $gray: rgba(0,0,0,0.3);
  
  .b-red {
    color: $uni-primary;
  }
  .b-gray {
    color: $gray;
  }
  .b-right {
    gap: 30rpx;
  }
  .money-symbol {
    font-size: 22rpx;
    margin-right: 2px;
  }
  
  .confirm-order {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
    
    .space-between {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
    }
    .box {
      background: #fff;
      padding: 28rpx 32rpx;
      margin: 0 0 12rpx;
      font-size: 28rpx;
      color: rgba(0, 0, 0, 0.65);
    }
		
		.pay-radio-group {
			margin: 0;
			border-top: 1px solid rgba(0, 0, 0, 0.08);
		}
    
    .order-body {
      flex: 1;
      height: calc(100vh - 100rpx);
      overflow-y: auto;
    }
    .order-footer {
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-direction: row;
      height: 100rpx;
      padding: 10rpx 20rpx;
      background-color: #fff;
      .total {
        display: flex;
        flex-direction: row;
        padding: 0 10rpx 0 30rpx;
        font-size: 28rpx;
        color: rgba(0, 0, 0, 0.65);
        .t-price {
          display: flex;
          flex-direction: row;
          color: $uni-primary;
        }
      }
      .btn-submit {
        width: 210rpx;
        height: 80rpx;
        line-height: 80rpx;
        border-radius: 6rpx;
        text-align: center;
        color: #fff;
        background-color: $uni-primary;
      }
    }
    
    // 门店信息
    .store-info {
      .store-logo {
        width: 120rpx;
        height: 96rpx;
      }
      gap: 20rpx;
      .si-name {
        text-shadow: 0 0 0.1px currentcolor;
      }
      .si-address {
        display: flex;
        gap: 5px;
      }
    }
    
    // 到店日期
    .co-date {
      margin: 35rpx 0 0;
    }
    
    // 商品信息列表
    .goods-list {
      .goods-info {
        display: flex;
        flex-direction: row;
        gap: 25rpx;
        padding: 20rpx;
        border-top: 1px solid #eee;
        &.first {
          border: 0;
        }
      }
      .goods-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .goods-name {
          flex: 0 !important;
          /deep/.u-text{
            text-shadow: 0 0 0.1px currentcolor;
          }
        }
      }
	  .promotion{
		  
		 display: flex;
		 flex-wrap: wrap;
		 padding-top: 10rpx;
		  .name{
			  margin-right: 10rpx;
			  border: 1px solid #f56c6c;
			  color: #f56c6c;
			  background-color: #fef0f0;
			  border-radius: 4rpx;
			  font-size: 12px;
			  padding: 4rpx 8rpx;
			  margin-bottom: 10rpx;
		  }
	  }
      .price-number {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        .pn-price {
          color: $uni-primary;
        }
      }
    }
		
		
		// 授信额度支付
		.popup-content {
			width: 100%;
			display: flex;
			flex-direction: column;
			background-color: #F7F8FA;
			border-top-left-radius: 20rpx;
			border-top-right-radius: 20rpx;
			overflow: hidden;
			.pc-title {
				width: 100%;
				text-align: center;
				padding: 40rpx 0;
				font-size: 14px;
				color: #323233;
				background-color: #ffffff;
				border-bottom: 1px solid rgba(0, 0, 0, 0.08);
			}
			.pc-desc {
				padding: 34rpx 60rpx 60rpx;
				color: rgba(0, 0, 0, 0.85);
				background-color: #ffffff;
			}
			.pc-action {
				margin-top: 16rpx;
				width: 100%;
				background-color: #ffffff;
				padding: 30rpx 32rpx 68rpx;
				box-sizing: border-box;
			}
			.pc-btn {
				text-align: center;
				padding: 26rpx 0;
				font-size: 16px;
				color: #ffffff;
				background-color: #CF1A1B;
				border-radius: 8rpx;
			}
		
		}
  }
</style>
